<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
	#img{
		list-style-type: none;
		margin: 2px;
		/*height: 118px;*/
		float: left;
	}
	.divImg{
		float: left;
		margin: 2px;
		padding: 2px;
		height:108px;
		width:100px;
		border: 1px solid #dcdcdc;
		cursor: pointer;
	}
	.divImgD{
		float: left;
		margin: 2px;
		padding: 2px;
		height:108px;
		width:100px;
		border: 1px solid red;
		cursor: pointer;
	}


	#img_detail{
		list-style-type: none;
		margin: 2px;
		/*height: 118px;*/
		float: left;
	}
	.divImgDetail{
		float: left;
		margin: 2px;
		padding: 2px;
		height:108px;
		width:100px;
		border: 1px solid #dcdcdc;
		cursor: pointer;
	}

</style>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${cmsMaterial.id}"  type="hidden">
							<div class="form-group">	
								<label class="col-sm-3 control-label">标题：</label>
								<div class="col-sm-8">
									<input id="title" name="title" th:value="${cmsMaterial.title}" class="form-control" type="text">
								</div>
							</div>
														<!--<div class="form-group">	-->
								<!--<label class="col-sm-3 control-label">图片数据：</label>-->
								<!--<div class="col-sm-8">-->
									<!--<input id="images" name="images" th:value="${cmsMaterial.images}" class="form-control" type="text">-->
								<!--</div>-->
							<!--</div>-->
							<!-- <div class="form-group">
								<label for="file_upload" class="col-sm-3 control-label">商品轮播图</label>

								<div class="col-sm-8">
									<div id="file_upload">
									</div>
									<div id="logo">

									</div>
									<input id="images" name="images" type="hidden" th:value="${cmsMaterial.images}">
								</div>
							</div> -->
														<div class="form-group">	
								<label class="col-sm-3 control-label">内容：</label>
								<div class="col-sm-8">
								<textarea id="content" name="content" th:text="${cmsMaterial.content}" class="form-control" type="text"></textarea>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">显示位置：</label>
								<div class="col-sm-8">
									<label class="radio-inline"> <input
											th:field="*{cmsMaterial.address}" type="radio" name="address" value="0" />
										首页
									</label> <label class="radio-inline"> <input
										th:field="*{cmsMaterial.address}" type="radio" name="address" value="1" />
									商城
								</label>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">显示状态：</label>
								<div class="col-sm-8">
									<label class="radio-inline"> <input
											th:field="*{cmsMaterial.status}" type="radio" name="status" value="0" />
										显示
									</label> <label class="radio-inline"> <input
										th:field="*{cmsMaterial.status}" type="radio" name="status" value="1" />
									隐藏
								</label>
								</div>
							</div>
							
							
							<div class="form-group">
								<label class="col-sm-3 control-label">跳转类型：</label>
								<div class="col-sm-8">
									<!--<input id="status" name="status" class="form-control" type="text">-->
									<label class="radio-inline"> <input th:checked="${cmsMaterial.mode==0}" type="radio" id="0" name="mode" value="0" />
										跳商品
									</label>
									<!--<label class="radio-inline"> <input th:checked="${cmsMaterial.mode==1}" type="radio" name = "mode" value="1" />
										跳链接
									</label>-->
									<label class="radio-inline"> <input th:checked="${cmsMaterial.mode==1}" type="radio" id="1" name = "mode" value="1" />
										跳文章
									</label>
									<label class="radio-inline"> <input th:checked="${cmsMaterial.mode==2}" type="radio" id="2" name = "mode" value="2" />
										不跳
									</label>
								</div>
							</div>
							<!--<div class="form-group">
								<label class="col-sm-3 control-label">跳转链接：</label>
								<div class="col-sm-8">
									<input id="linkUrl" name="linkUrl" th:value="${cmsMaterial.linkUrl}" class="form-control" type="text">
								</div>
							</div>-->
							<div class="form-group" id="goodsDiv">
								<label class="col-sm-3 control-label">跳转商品：</label>
								<div class="col-sm-8">
									<select data-placeholder="--选择商品--" name="goodsId" id="goodsId"
											class="form-control chosen-select" tabindex="2">
										<option value="">-- 选择商品 --</option>
										<option th:each="goods : ${goodsList}"
												th:value="${goods.id}"
												th:text="${goods.name}"
												th:selected="${goods.id==cmsMaterial.goodsId}"></option>
									</select>
								</div>
							</div>
							<div class="form-group" id="contentDiv">
								<label class="col-sm-3 control-label">跳转文章：</label>
								<div class="col-sm-8">
									<select data-placeholder="--选择文章--" name="goodsId" id="lessonContent"
											class="form-control chosen-select" tabindex="2">
										<option value="">-- 选择文章--</option>
										<option th:each="content : ${contentList}"
												th:value="${content.id}"
												th:text="${content.name}"
												th:selected="${content.id==cmsMaterial.goodsId}"></option>
									</select>
								</div>
							</div>
																					<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>
	<script src="/js/layui.js"></script>
	<script type="text/javascript" src="/js/appjs/wx/cmsMaterial/edit.js">
	</script>
	<script language="JavaScript" th:inline="javascript">
		var imgNum=0;
		var strImg ='';
		if([[${cmsMaterialImg}]]!=undefined && [[${cmsMaterialImg}]]!=[]) {
			var banners =[[${cmsMaterialImg}]];
			var i = 0;
			for (o in banners) {
				i++;
				imgNum++;
				strImg  += '<div id="imgId'+imgNum+'" class="divImg">' +
						'<img src="'+banners[o]+'" style="width:100px;height: 80px;margin-bottom: 1px;"><br>' +
						'<i style="float: right;padding-top: 4px;" class="fa fa-close"' +
						' onclick="delImg(\'imgId' + imgNum  +'\')"></i></div>';
			}
		}
		$('#logo').html(strImg);

	</script>
</body>
</html>
